A man-page inspired Markdown pager written in C.
Name change: executable's name changed to mdn
Need to lookup things from README? Or from manual page? Or perhaps just want to install something cool...
- User Customization
- Added control schemes: mdn, vim, less(default since mdn isn't complete)
- Config file location:
~/.config/mdn/mdnrc
Mandown requires libncurses(w)
, libxml2
and libconfig
as compile-time dependencies.
Make sure you have them installed before compiling.
$ apt-get install libncursesw5-dev
$ apt-get install libxml2-dev
$ apt-get install libconfig-dev
Current version is still being developed for some HTML tags. However, it should work on most Markdown documents.
$ brew install mandown
The installed binary mdn
would be at /usr/local/bin/
$ git clone https://github.com/Titor8115/mandown.git
$ cd mandown
$ make install
To remove the binary, you can run the commands below, or remove manually.
$ cd mandown
$ make uninstall
If you just want to compile and test it.
$ cd mandown
$ make
Feel free to create an issue.
Check out the new sample
$ mdn sample.md
Mouse scrolling is supported! (if your terminal emulator allows)
Move Up: Up, k
Move Down: Down, j
Page Up: Space, PgUp, b
Page Down: Bksp, PgDn, f
Show href in hyperlink: Tab + Enter, or double click mouse 1
Exit: q
To read detailed usage, run mdn -h
Mandown can also be embedded in your own applications. To render a Markdown document in a C string:
#include "mandown.h"
char *str ="# Heading\n\nThis is some **BOLD** *italic* ***EMPHASIZED*** text.";
render_str(str, "md", "Test Title", NULL);
To render a Markdown document file:
#include "mandown.h"
FILE *fp = fopen("README.md", "r");
render_file(fp, "md", "Test file", NULL);
Static and shared libraries are available. Make sure you have installed the dependencies listed in Library dependency below, then assuming you installed Mandown under /usr/local
:
# static build
gcc -o myprog -I/usr/local/include myprog.c /usr/local/lib/mandown.a -lncurses -lxml2 -lconfig
# shared build
gcc -o myprog -I/usr/local/include myprog.c -L/usr/local/lib -lmandown -lncurses -lxml2 -lconfig
tests
- Line fold/wrap on white space
- Optimized resizing
- Makefile makeover
- Add more config options
- Table and contents rendering